package ocl;


public class CollectionFunctionRefExpression extends OclExpression {

	OclExpression exp, calledOn;
	VariableDeclaration vdecl;
	SimpleName simpleName;
	
	public CollectionFunctionRefExpression(OclExpression oclExpression,
			SimpleName simpleName, OclExpression oclExpression2) {
		this(oclExpression, simpleName, null, oclExpression2);
	}

	public CollectionFunctionRefExpression(OclExpression oclExpression,
			SimpleName simpleName, VariableDeclaration variableDeclaration,
			OclExpression oclExpression2) {
		this.exp = oclExpression;
		this.simpleName = simpleName;
		this.vdecl = variableDeclaration;
		this.calledOn = oclExpression2;
	}

	@Override
	public String toK() {
		if (vdecl == null)
		{
			return exp.toK() + "->" + simpleName.toK() + "(" + calledOn.toK() + ")";
		}
		else
		{
			return exp.toK() + "->" + simpleName.toK() + "(" + vdecl.toK() + "|" + calledOn.toK() + ")";
		}
	}
}
